﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Data;
using System.Collections.ObjectModel;
using Medianamik.Core.Security;

namespace Medianamik.Core.DAL
{
    public interface INodeTypeDALProvider
    {

        
        bool PropertyHasDuplicateValues(Guid pPropertyID);

        List<NodeType> GetAllTypes(bool pIncludeManyToManys);
        IEnumerable<NodeTypeInterface> GetAllInterfaces();

        IEnumerable<HierarchicalRule> GetAllHierarchicalRules();
        
        void TransacSave(IEnumerable<NodeTypeDataShell> nodeTypeDataShells);

        void TransacSaveInterfaces(IEnumerable<NodeTypeInterfaceDataShell> nodeTypeInterfaceDataShells);
        
        bool NodeTypeExists(string pTypeName, out Guid pTypeID);

        int TypeNodesCount(Guid pTypeID, bool blockInheritance);

        IEnumerable<NodeTypeProperty> GetAllNodeTypeProperties();
        IEnumerable<NodeTypeInterfaceProperty> GetAllNodeTypeInterfaceProperties();

        IEnumerable<NodeTypeInterfaceImplementation> GetNodeTypeInterfaces(Guid typeId);

        void UpdateTypeProperty(NodeTypeProperty pTypeProperty);
        void DeleteTypeProperty(Guid pTypePropertyID);
        
        /// <summary>
        /// Get OneToMany relations where the Type passed in parameter is the primary Key
        /// </summary>
        /// <param name="pTypeIds"></param>
        /// <returns></returns>
        Collection<OneToManyRelation> GetPrimaryRelations(IEnumerable<Guid> pTypeIds);

        /// <summary>
        /// Get foreign keys for the type passed in parameter
        /// </summary>
        /// <param name="pTypeIds"></param>
        /// <returns></returns>
        Collection<OneToManyRelation> GetForeignRelations(IEnumerable<Guid> pTypeIds);
        Collection<ManyToManyRelation> GetManyToManyRelations(IEnumerable<Guid> pTypeId);



        IEnumerable<TypeTemplate> GetAllTemplates();

        IEnumerable<NodeTypeInterfaceImplementation> GetNodeTypes(Guid interfaceId);
    }
}
